<template>
    <div class="wrap">
        <div class="rentBox">
        <div class="header">
            <i class="iconfont icon-zuojiantou" @click="router.back()"></i>
            <el-input v-model="keyWord"  @keydown="keydown">
                <template #prefix>
                    <el-icon class="el-input__icon"><search /></el-icon>
                </template>
            </el-input>
            <i class="iconfont icon-zhuanfa"></i>
            <i class="iconfont icon-gengduo"></i>
        </div>
        <div class="showBox">
            <div class="show-header">
                <img :src="goodsMsg.merchantImages">
                <div class="username">{{goodsMsg.merchantName}}</div>
                <div class="btn" @click="like(3)">关注</div>
            </div>
            <div class="priceLine">
                <div class="price">￥{{goodsMsg.priceMonth}}/月</div>
                <div style="color:#ccc">{{goodsMsg.want}}人想租&nbsp;|&nbsp;{{goodsMsg.views}}浏览</div>
            </div>
            <div class="intro">
                {{goodsMsg.title}}
            </div>
            <div class="images">
                <img :src="goodsMsg.coverImages">
            </div>
        </div>
        <div class="enterBox">
            <div class="intro">
                <div style="font-size:20px;font-weight:bold">想租圈</div>
                <div>4&nbsp;位小伙伴已经进圈啦</div>
            </div>
            <div class="btn">进圈</div>
        </div>
    </div>
    <div class="footer">
        <div class="icon">
            <i class="iconfont icon-xinxi"></i>
            <span>回复</span>
        </div>
        <div class="icon" @click="like(1)">
            <i class="iconfont icon-aixin"></i>
            <span>喜欢</span>
        </div>
        <div class="icon" @click="like(2)">
            <i class="iconfont icon-shoucang"></i>
            <span>收藏</span>
        </div>
        <div class="btn">想租</div>
        <div class="btn" style="background-color:#F0BF2D">面洽</div>
    </div>    
    </div>

</template>

<script setup> 
import {ref,onMounted, reactive} from "vue"
import {useRouter} from 'vue-router'
import {useStore} from 'vuex'
const store = useStore();
const router = useRouter();
const keyWord=ref("")
let goodsMsg=reactive(store.state.together.curGoods)
let isLike=ref(false)//点赞
let isSave=ref(false)//收藏
let isFocus=ref(false)//关注
onMounted(()=>{
    //等有获取点赞状态的接口再设置初值
})
//点赞函数
const like=(val)=>{
    store.dispatch("together/setLike",val)
}
//关键词搜索函数
let keydown = function(e){
    if (e.key == "Enter" ){
        //设置关键词
        store.commit("together/setKeyWord",keyWord.value)
        //回车触发发送消息事件
        router.push('/together')
    }
}
</script>

<style lang="scss" scoped>

.rentBox{
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    width: 100%;
    height: 8.46rem;
    background-color: rgb(244,248,238);
}
.header{
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 90%;
    height: 0.5rem;
    i{
        font-size: 0.24rem;
        margin: 0px 0.1rem
    }
    .el-input{
        height: 0.5rem;
        i{
            font-size: 0.2rem;
            color: #6FA11E;
        }
        ::v-deep .el-input__wrapper{
            padding: 0.1rem;
            border-radius: 0.25rem;
            .el-input__inner{
                text-align: left;
            }
        }
    }  
}
.showBox{
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    width: 90%;
    height: 5rem;
    border-radius: 0.2rem;
    background-color: #fff;
    box-shadow: 1px 1px 5px 2px #ccc;
    .show-header{
        width: 90%;
        height: 0.6rem;
        display: flex;
        justify-content: space-around;
        align-items: center;
        margin-top: 0.2rem;
        img{
            width: 0.6rem;
            height: 0.6rem;
            border-radius: 50%;
            margin-right: 0.2rem;
        }
        .username{
            
            width: 2rem;
            align-self: start;
            font-size: 0.2rem;
            font-weight: bold;
            margin-top:10px
        }
        .btn{
            display: flex;
            justify-content: center;
            align-items: center;
            width: 0.8rem;
            height: 0.4rem;
            border-radius: 0.2rem;
            font-size: 0.2rem;
            color: #fff;
            background-color: #6FA11E;
        }
    }
    .priceLine{
        display: flex;
        width: 90%;
        height: 0.6rem;
        justify-content: space-between;
        align-items: center;
        .price{
            font-size: 0.3rem;
            color: #F7CB28;
        }
    }
    .intro{
        width: 90%;
        height: 1.5rem;
        font-size: 0.2rem;
    }
    .images{
        display: flex;
        justify-content: center;
        align-items: center;
        
        width: 90%;
        height: 2rem;
        img{
            width: 1.5rem;
            height: 1.5rem;
        }
    }
}
.enterBox{
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 90%;
    height: 1rem;
    border-radius: 0.1rem;
    background-color: #6FA11E;
    .btn{
        display: flex;
        justify-content: center;
        align-items: center;
        width: 0.8rem;
        height: 0.4rem;
        border-radius: 0.2rem;
        font-size: 0.18rem;
        color: #6FA11E;
        background-color: #fff;
    }
    .intro{
        height: 0.8rem;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        color: #fff;
        
    }
}
.footer{
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    height: 0.8rem;
    background-color: #fff;
    .icon{
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        align-items: center;
        width: 0.6rem;
        height: 0.6rem;
        i{
            color: #aaa;
            font-size: 0.3rem;
        }
        span{
            color: #aaa;
            font-size: 0.2rem;
        }
    }
    .btn{
        display: flex;
        justify-content: center;
        align-items: center;
        width: 1.1rem;
        height: 0.6rem;
        border-radius: 0.3rem;
        color: #fff;
        font-size: 0.2rem;
        font-weight: bold;
        background-color: #6FA11E;
    }
}

</style>